﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.IO;

namespace Project
{
    public partial class FirstForm : Form
    {
        string path = @"C:\Users\Ольга\Desktop\";
        public FirstForm()
        {
            InitializeComponent();
        }

        private void bAddNew_Click(object sender, EventArgs e)
        {
            Anketa anketa = new Anketa();
            anketa.Show();
        }

        private void bPayment_Click(object sender, EventArgs e)
        {
            Payment payment = new Payment();
            payment.Show();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            ServiceReference.WebServiceSoapClient client = new ServiceReference.WebServiceSoapClient();

            string s = File.ReadAllText(path+"ExampleXML.xml");

            XmlDocument doc = new XmlDocument();
            doc.LoadXml(s);
            foreach (XmlNode xm in doc.ChildNodes)
            {
                if (client.writeCustomerToBase(xm.InnerXml))
                {
                    xm.ParentNode.RemoveChild(xm);
                }
                else
                    MessageBox.Show("Не удалось сохранить!");
            }
        }
    }
}
